#include "stdafx.h"
#include "gpError.h"

gp_Exception::gp_Exception():
	m_message("")
{
}

gp_Exception::gp_Exception(string msg)
{
	m_message = msg;
}

gp_Exception::~gp_Exception() throw()
{
}

void gp_Exception::setMessage(string msg)
{
	m_message = msg;
}

const char * gp_Exception::what() const throw()
{
	return m_message.c_str();
}


void Standard_ConstructionError_Raise_if(bool condition, const char* message)
{
	if (condition) 
	{
		throw gp_Exception("ConstructionError:"+string(message));
	}
}

void Standard_OutOfRange_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("OutOfRange:" + string(message));
	}
}

void Standard_RangeError_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("RangeError:" + string(message));
	}
}

void Standard_NumericError_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("NumericError:" + string(message));
	}
}

void Standard_DimensionError_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("DimensionError:" + string(message));
	}
}

void Standard_DomainError_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("DomainError:" + string(message));
	}
}

void gp_VectorWithNullMagnitude_Raise_if(bool condition, const char * message)
{
	if (condition)
	{
		throw gp_Exception("VectorWithNullMagnitude:" + string(message));
	}
}

